Skip to content

Address Wagtail CSP issues #6052

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 12, 2024

Conversation

escattone
Copy link
Contributor

@escattone escattone commented Jun 6, 2024

mozilla/sumo#1817

Highlights

  • This PR ensures a tight CSP policy for Wagtail CMS login page (/cms/login/), but loosens the policy with unsafe-inline for script-src and style-src for all of the other Wagtail CMS pages (/cms/*), which are currently restricted to Mozilla LDAP users.
  • It looks possible to remove unsafe-inline for all of the non-login Wagtail CMS pages, but that'll require calculating some hashes for scripts that are constant, overriding about 17 other templates (by copying most of their code) and adding a nonce to all of their inline scripts, and that's only what I know so far. There may be more. All of that work is postponed until a later date. Hopefully, Wagtail will resolve more of their CSP issues before we need to tackle that, but I think we'll need to tackle that at the point when we're ready to open the Wagtail CMS to users outside of Mozilla.
  • It adds a new wagtail.scss file that's built by our usual webpack flow and included in all of the Wagtail CMS pages, so we can add our own CSS as needed.
  • It overrides wagtail/admin/templates/wagtailadmin/admin_base.html with kitsune/sumo/templates/wagtailadmin/admin_base.html to include a nonce to secure the inline script it contains. It's not clean in the sense that it copies code from Wagtail, but I couldn't see any other way forward.

@escattone escattone merged commit dbe82a5 into mozilla:main Jun 12, 2024
2 checks passed
@escattone escattone deleted the resolve-wagtail-csp-issues-1817 branch June 12, 2024 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants